package com.xinz.model;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;
import com.google.code.morphia.annotations.Transient;

@Entity(noClassnameStored = true)
public class Player extends BaseModel {
	
	@Id
	private String id;
	
	private String name;		// 名称
	private String headIcon;	// 头像
	private boolean isBoy;		// 性别
	private int money;			// 游戏币
	private int gold;			// RMB
	private int totalGold;		// 历史花费的RMB
	private int score;			// 积分
	private int status;			// 状态 0、离线 1、在线
	
	private int createTime;		// 创建时间
	private int accessTime;		// 最近访问时间
	private int loginTime;		// 登陆时间
	private int lastLoginTime;	// 上次登陆时间
	private int banAccountTime;	// 封号至时间（解的时间）
	
	private int winTimes;		// 胜利次数
	private int loseTimes;		// 失败次数
	private int drawTimes;		// 平局次数
	private int fleeTimes;		// 逃跑次数
	
	// 对战相关属性
	@Transient
	private String targetPid;			// 对战方
	@Transient
	private int battleStatus = -1;		// 棋局状态（-1、登陆状态，还没开始棋局）
	@Transient
	private int room;					// 房间
	@Transient
	private int camp = -1;				// 阵营， -1、战斗双方初始 0、红 1、绿
	@Transient
	private long matchTime;  			// 匹配时间，超过时间不确认自动取消
	
	@Transient
	protected long updateTime;
	public long getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime() {
		this.updateTime = System.currentTimeMillis();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public String getId() {
		return id;
	}
	public void setName(String name) {
		this.name = name;
		setUpdateTime();
	}
	public String getName() {
		return name;
	}
	public void setHeadIcon(String headIcon) {
		this.headIcon = headIcon;
		setUpdateTime();
	}
	public String getHeadIcon() {
		return headIcon;
	}
	public void setBoy(boolean isBoy) {
		this.isBoy = isBoy;
		setUpdateTime();
	}
	public boolean isBoy() {
		return isBoy;
	}
	public void setMoney(int money) {
		this.money = money;
		setUpdateTime();
	}
	public int getMoney() {
		return money;
	}
	public void setGold(int gold) {
		this.gold = gold;
		setUpdateTime();
	}
	public int getGold() {
		return gold;
	}
	public void setScore(int score) {
		this.score = score;
		setUpdateTime();
	}
	public int getScore() {
		return score;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public int getStatus() {
		return status;
	}
	public void setCreateTime(int createTime) {
		this.createTime = createTime;
		setUpdateTime();
	}
	public int getCreateTime() {
		return createTime;
	}
	public void setAccessTime(int accessTime) {
		this.accessTime = accessTime;
	}
	public int getAccessTime() {
		return accessTime;
	}
	public void setLoginTime(int loginTime) {
		this.loginTime = loginTime;
	}
	public int getLoginTime() {
		return loginTime;
	}
	public void setLastLoginTime(int lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public int getLastLoginTime() {
		return lastLoginTime;
	}
	public void setBanAccountTime(int banAccountTime) {
		this.banAccountTime = banAccountTime;
	}
	public int getBanAccountTime() {
		return banAccountTime;
	}
	public void setWinTimes(int winTimes) {
		this.winTimes = winTimes;
		setUpdateTime();
	}
	public int getWinTimes() {
		return winTimes;
	}
	public void setLoseTimes(int loseTimes) {
		this.loseTimes = loseTimes;
		setUpdateTime();
	}
	public int getLoseTimes() {
		return loseTimes;
	}
	public void setDrawTimes(int drawTimes) {
		this.drawTimes = drawTimes;
		setUpdateTime();
	}
	public int getDrawTimes() {
		return drawTimes;
	}
	public void setFleeTimes(int fleeTimes) {
		this.fleeTimes = fleeTimes;
		setUpdateTime();
	}
	public int getFleeTimes() {
		return fleeTimes;
	}
	public String getTargetPid() {
		return targetPid;
	}
	public void setTargetPid(String targetPid) {
		this.targetPid = targetPid;
		setUpdateTime();
	}
	public int getBattleStatus() {
		return battleStatus;
	}
	public void setBattleStatus(int battleStatus) {
		this.battleStatus = battleStatus;
		setUpdateTime();
	}
	public int getRoom() {
		return room;
	}
	public void setRoom(int room) {
		this.room = room;
		setUpdateTime();
	}
	public int getCamp() {
		return camp;
	}
	public void setCamp(int camp) {
		this.camp = camp;
	}
	public long getMatchTime() {
		return matchTime;
	}
	public void setMatchTime(long matchTime) {
		this.matchTime = matchTime;
	}
	public int getTotalGold() {
		return totalGold;
	}
	public void setTotalGold(int totalGold) {
		this.totalGold = totalGold;
	}
}
